package io.springboot.jpa.examples.springbootjpaexamples.model;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author yzc
 * @description
 * @date 2018/9/10
 */
@Entity
@Table(name = "seal")
public class Seal extends BaseBean implements Serializable {
    private static final long serialVersionUID = 4690507247920203893L;

    private String name;
    private Organization organization;
    private Enterprise enterprise;
    private List<Certificate> certificateList = new ArrayList<>();

    @Column(name = "name", length = 50)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @ManyToOne
    @JoinColumn(name = "organization_id")
    public Organization getOrganization() {
        return organization;
    }

    public void setOrganization(Organization organization) {
        this.organization = organization;
    }

    @ManyToOne
    public Enterprise getEnterprise() {
        return enterprise;
    }

    public void setEnterprise(Enterprise enterprise) {
        this.enterprise = enterprise;
    }

    @JsonIgnore
    @OneToMany
    @JoinColumn(name = "seal_id")
    public List<Certificate> getCertificateList() {
        return certificateList;
    }

    public void setCertificateList(List<Certificate> certificateList) {
        this.certificateList = certificateList;
    }
}
